import { ref, reactive} from 'vue'


//date
let errorMgs = ref("")
let loginBut = ref(false)
let activeName = ref('first')
const uploadForm = ref() // 新增组别表单 DOM
let formLogin = reactive({
    username: "admin",
    password: "admin"
})
// 表单验证
const rules = reactive({
    username: [
        {pattern: /^[a-zA-Z0-9_-]{4,16}$/, message: '手机号或邮箱式不对', trigger: 'blur'},
        {required: true, message: '请输入手机号或邮箱', trigger: 'blur'},
    ],
    password: [
        {required: true, message: '请输入密码', trigger: 'blur'},
    ]
})

export function validate() {
    uploadForm.value.validate((valid) => {
        loginBut.value = !valid
    })
}



export default{
    rules,
    errorMgs,
    loginBut,
    activeName,
    uploadForm,
    formLogin
}

